<script src="/public/static/js/jquery.min.js"></script>
<script src="/public/static/plugin/layer/layer.js"></script>

<style>
	.contain{
		margin-top: 10px;
		padding-left: 10px;
		font-size:13px;
		margin-right: 10px;
		font-family: 微软雅黑, "Source Sans Pro", sans-serif;
		width: 500px;
	}
	.line{
		padding-top: 5px;
		padding-bottom: 5px;
		padding-left: 10px;
		padding-right: 10px;
        border-bottom: 1px solid #ccc;
        width: 450px;
        float: left;
        word-wrap: break-word; word-break: normal;
	}
	.red{
		color: red;;
	}
	.info{
		width: 450px;
        float: left;
        padding-left: 10px;
        margin-bottom: 20px;
        margin-top: 5px;
	}
	.info .text{
		color: #00A0E9;
		padding-right: 20px;
	}
	a,a:hover{
		text-decoration: none;
	}
</style>

<div class="contain">
	<div class="info">
		活动ID：<span class="text"><{$info.activity_id}></span>
		活动名称：<span class="text"><{$info.activity_name}></span>
	</div>	
	<input type="hidden" name="g" value="<{$g}>" />
	<{foreach from=$synchroInfo item=item key=key}>
	<div class="line">
	    <{$item.server_list}><span <{if $item.status != 1}>class="red"<{/if}> ><{$item.status_text}></span> &nbsp;&nbsp;&nbsp;
	    <{if $item.open != '' }>
	    	<span style="float: right;" class="open"><{$item.open}></span>
	    <{/if}>
	    <{if $item.action != '' }>
	    	<span style="float: right;" class="action_<{$key}>"><{$item.action}></span>
	    <{/if}>
	    
	    
    </div>
    
    <script>
    	var a = $('.action_<{$key}>').text();
    	$('.action_<{$key}>').html(a);
    </script>
    <{/foreach}>	
    	
</div>


<script>
	    /**单独作废**/
        $(document).on('click','a[name="active_cancle_one"]',function(){
        	var id = $(this).attr('data-id');
        	updateStatus(id,2);
        });
        /**单独关闭**/
        $(document).on('click','a[name="active_close_one"]',function(){
        	var id = $(this).attr('data-id');
        	updateStatus(id,1);
        });
        
        
        
        function updateStatus(id,type){
        	var type_text = '';
        	if(type == 2){
        		type_text = '作废';
        	}
        	if(type == 1){
        		type_text = '关闭';
        	}
        	var loading = null;
        	layer.confirm('确定'+type_text+'!', {
        			btn: ['确定','取消'] //按钮
        			,skin: 'layui-layer-molv'
        	}, function(){
        	        var data_url = '?r=activity/infoUpdate';
                    var g = $("input[name='g']").val();
                    var url = data_url+'&g='+g;
                    //console.log(url);
                    uploading = layer.load(1, {shade: [0.4, '#393D49']});
                    $.ajax({
        	        	type : 'POST',
    			        url : url,
				        data : {'id':id,'type':type},
				        dataType :'JSON',
				        success : function(res){
				        	layer.close(uploading);
				        	if(res.status == 1){
				        		layer.alert(res.msg, {
				        			skin: 'layui-layer-molv' //样式类名
						            ,closeBtn: 0
					            }, function(){
						             //window.parent.location.reload();
						             window.location.reload();
					            });	
				        		//layer.alert(res.msg, {skin: 'layui-layer-molv'});
					        }else{
						        layer.alert(res.msg, {icon: 2, skin: 'layui-layer-molv'});
					        }
				        }
			        });
                    
        	    }, function(){
        			//取消
        		});
        }
</script>

